package com.warom.sdg.model;

/**
 * 操作日志实体类
 * 记录用户在系统中的各种操作行为
 */
public class OperationLogEntity {
    private long id;                    // 主键ID
    private String username;            // 操作用户名
    private String operationType;       // 操作类型（如：DEVICE_CONTROL、CONFIG_CHANGE等）
    private String operationDescription; // 操作描述
    private String operationPage;       // 操作页面
    private String operationTarget;     // 操作目标（设备名称、配置项名称等）
    private String operationStatus;     // 操作状态（SUCCESS、FAILED）
    private String errorMessage;        // 错误信息（操作失败时的详细信息）
    private long operationTime;         // 操作时间戳
    private String operationTimeString; // 操作时间字符串（便于显示）
    private String ipAddress;           // 操作者IP地址
    private String userAgent;           // 用户代理信息

    // 构造函数
    public OperationLogEntity() {
    }

    public OperationLogEntity(String username, String operationType, String operationDescription, 
                             String operationPage, String operationTarget, String operationStatus) {
        this.username = username;
        this.operationType = operationType;
        this.operationDescription = operationDescription;
        this.operationPage = operationPage;
        this.operationTarget = operationTarget;
        this.operationStatus = operationStatus;
        this.operationTime = System.currentTimeMillis();
    }

    // Getter和Setter方法
    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getOperationType() {
        return operationType;
    }

    public void setOperationType(String operationType) {
        this.operationType = operationType;
    }

    public String getOperationDescription() {
        return operationDescription;
    }

    public void setOperationDescription(String operationDescription) {
        this.operationDescription = operationDescription;
    }

    public String getOperationPage() {
        return operationPage;
    }

    public void setOperationPage(String operationPage) {
        this.operationPage = operationPage;
    }

    public String getOperationTarget() {
        return operationTarget;
    }

    public void setOperationTarget(String operationTarget) {
        this.operationTarget = operationTarget;
    }

    public String getOperationStatus() {
        return operationStatus;
    }

    public void setOperationStatus(String operationStatus) {
        this.operationStatus = operationStatus;
    }

    public String getErrorMessage() {
        return errorMessage;
    }

    public void setErrorMessage(String errorMessage) {
        this.errorMessage = errorMessage;
    }

    public long getOperationTime() {
        return operationTime;
    }

    public void setOperationTime(long operationTime) {
        this.operationTime = operationTime;
    }

    public String getOperationTimeString() {
        return operationTimeString;
    }

    public void setOperationTimeString(String operationTimeString) {
        this.operationTimeString = operationTimeString;
    }

    public String getIpAddress() {
        return ipAddress;
    }

    public void setIpAddress(String ipAddress) {
        this.ipAddress = ipAddress;
    }

    public String getUserAgent() {
        return userAgent;
    }

    public void setUserAgent(String userAgent) {
        this.userAgent = userAgent;
    }

    @Override
    public String toString() {
        return "OperationLogEntity{" +
                "id=" + id +
                ", username='" + username + '\'' +
                ", operationType='" + operationType + '\'' +
                ", operationDescription='" + operationDescription + '\'' +
                ", operationPage='" + operationPage + '\'' +
                ", operationTarget='" + operationTarget + '\'' +
                ", operationStatus='" + operationStatus + '\'' +
                ", errorMessage='" + errorMessage + '\'' +
                ", operationTime=" + operationTime +
                ", operationTimeString='" + operationTimeString + '\'' +
                ", ipAddress='" + ipAddress + '\'' +
                ", userAgent='" + userAgent + '\'' +
                '}';
    }

    // 操作类型常量
    public static class OperationType {
        public static final String DEVICE_CONTROL = "DEVICE_CONTROL";      // 设备控制
    }

    // 操作状态常量
    public static class OperationStatus {
        public static final String SUCCESS = "SUCCESS";    // 成功
        public static final String FAILED = "FAILED";      // 失败
        public static final String PENDING = "PENDING";    // 处理中
    }
} 